package gruppe7.tlrs;

import gruppe7.data.StationController;
import java.util.ArrayList;

public class TLRSControl {

    private static final String VERSION = "2.0";
    //private StationList stationList;
    private static TLRSControl trlsControl = null;

    public static TLRSControl getInstance() {
        if (trlsControl == null) {
            trlsControl = new TLRSControl();
        }
        return trlsControl;
    }

    private TLRSControl() {
        /*stationList = new StationList();
        setStations();*/
    }

    public Integer getZone(String stationName) {
        //return stationList.getStation(stationName).getZone();
        return StationController.getInstance().getStation(stationName).getZone();
    }

    public String getStationDetails(String stationName) {
        return StationController.getInstance().getStation(stationName).toString();
    }

    public String getVersion() {
        return VERSION;
    }

    public Station getStation(String name) {
        return StationController.getInstance().getStation(name);
    }

    public ArrayList<String> getStations() {
        return StationController.getInstance().getStationList();
    }
    public boolean updateStation(String oldName, String stationName, Integer zone, String manager, String date, String comment)
    {
        Station station = StationController.getInstance().getStation(oldName);
        station.setComment(comment);
        station.setErectionDate(date);
        if(manager.isEmpty());

        try
        {
            station = StationController.getInstance().updateStation(station);
            return true;
        }

        catch(Exception e)
        {
            e.printStackTrace();
            return false;
        }
    }
    
}
